<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="/navbar::header(电影管理)">
</head>
<body>
<div class="cd">
    <h2 class="kzmb">控制面板</h2>
    <hr style="color: #FFFFFF;margin-top: 33%">
    <h5 class="kzmb1">导航菜单</h5>
    <ul class="nav navbar-nav mr-auto mt-2 mt-lg-0">
        <li><a class="a" style="color: #fafafa" th:href="@{/admin/index}">主页</a></li>
        <li><a class="a" style="color: #fafafa" th:href="@{/admin/movie}">电影管理</a></li>
        <li><a class="a" style="color: #fafafa" th:href="@{/admin/slice}">排片管理</a></li>
        <li><a class="a" style="color: #fafafa" th:href="@{/admin/user}">用户管理</a></li>
        <li><a class="a" style="color: #fafafa" th:href="@{/admin/order}">订单管理</a></li>
        <li><a class="a" style="color: #fafafa" th:href="@{/admin/password}">密码管理</a></li>
    </ul>
    <h5 style="float: left;color: #3b5998;margin-left: 37%">admin</h5>
    <a class="btn btn-md btn-primary btn--wider" style="margin-left: 28%;float: left;margin-top: 5%" th:href="@{/ALogout}">
        退出
    </a>
</div>
<div class="container cd1" >
    <p style="margin-top: 1.2%;font-size: 25px;margin-left: 5%;background-image: -webkit-linear-gradient(bottom, rgb(201, 115, 255), rgb(20, 11, 255));-webkit-background-clip: text;
            -webkit-text-fill-color: transparent;">电影管理   &raquo;&raquo;</p>
    <hr>
    <form style="margin-left: 70%" th:action="@{/admin/movie/by}" th:method="get">
        <input class="input-medium search-query" th:name="name" th:placeholder="电影名字" type="text"/>
        <button class="btn btn-primary" type="submit">查找</button>
    </form>
    <a class="btn btn-primary bth-sm mb-3" style="margin-left: 5%;margin-top: -51px" th:href="@{/admin/movie/new}">新增电影</a>
    <br>
    <table class="table table-bordered table-striped" style="width: 95%;margin-left: 2.5%">
        <thead class="thead-dark rounded-md">
        <tr>
            <th>电影名称</th>
            <th>上映时间</th>
            <th>动作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="movie:${page.getRecords()}">
            <td th:text="${movie.name}"></td>
            <td th:text="${movie.onlin}"></td>
            <td>
                <a class="btn btn-info btn-sm" th:href="@{/admin/movie/updates(id=${movie.mId})}">更改</a>
                <a class="btn btn-danger btn-sm" onclick="if (!(confirm('你确定去删除这个项目吗'))) return false"
                   th:href="@{/admin/movie/delete(id=${movie.mId})}"
                   th:name="id"
                >删除</a>
            </td>
        </tr>
        </tbody>
    </table>
    <div style="position: absolute;top: 80%;margin-left: 3%">
        当前第[[${page.current}]]页 共[[${page.pages}]]页
    </div>
    <div style="position: absolute;top: 80%;left: 82.5%">
        <th:block th:if="${page.current>1}">
            <a class="btn btn-primary" th:href="@{/admin/movie(i=${page.getCurrent()-1})}">上一页</a>
        </th:block>
        <th:block th:if="${page.current==1}">
            <a class="btn btn-primary" href="#" onclick="(confirm(`好兄弟到顶啦`))">上一页</a>
        </th:block>
        <th:block th:if="${page.getCurrent}==${page.getPages()}">
            <a class="btn btn-primary" href="#" onclick="(confirm(`好兄弟到底啦`))">下一页</a>
        </th:block>
        <th:block th:if="${page.getCurrent}!=${page.getPages()}">
            <a class="btn btn-primary" th:href="@{/admin/movie(i=${page.getCurrent()+1})}">下一页</a>
        </th:block>
    </div>
</div>

</body>
</html>